package org.example.translate_braille.handler;

import com.baomidou.mybatisplus.core.handlers.MetaObjectHandler;
import org.apache.ibatis.reflection.MetaObject;
import org.joda.time.LocalDateTime;
import org.springframework.stereotype.Component;

import java.util.Date;

/**
 * <p>
 * mybatis-plus自动生成创建日期+修改日期
 * </p>
 *
 * @author Jacky
 * @since 2021-07-14
 */
@Component
public class MyMetaObjectHandler implements MetaObjectHandler {

    @Override
    public void insertFill(MetaObject metaObject) {
        this.strictInsertFill(metaObject, "uploadTime", Date.class, new Date());
        this.strictInsertFill(metaObject, "createTime", Date.class, new Date());
    }
    @Override
    public void updateFill(MetaObject metaObject) {
        //this.strictUpdateFill(metaObject, "modifiedTime", Date.class, new Date()); // 起始版本 3.3.0(推荐使用)
    }
}
